home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-24 | 2.1 KB | 111 lines | [TEXT/KAHL] |
- //
- // File: MyDrawMenuBar.c
- // Project: IsNative.π
- // Author: Glenn L. Austin
- // Symantec Corporation
- //
- #include "IsNative.h"
-
- static short cWidth = 0;
-
- typedef struct {
- MenuHandle menuOH;
- short menuLeft;
- } ItemMenu;
-
- typedef struct {
- short lastMenu;
- short lastRight;
- short mbResID;
- ItemMenu menuInfo[2]; // only need information on the Apple & File menus
- } MyMenuListRec;
-
- pascal void MyDrawMenuBar(void)
- {
- long oldA4 = SetA4World();
- GrafPtr oldPort, wMgrPort;
- short txFont, txSize, txMode;
- Style txFace;
- short cWidth;
- MyAppInfo* info;
- GDHandle mainGD;
-
- (*glob->oldDrwMBarTrap)();
-
- info = FindAppInfo(LMGetCurApName());
- if (info && (info->flags & kIsNative) && *(short *) *LMGetMenuList())
- {
- Boolean colorApple;
- GDevice* gd;
- short mLeft, mRight;
-
- {
- MyMenuListRec *mmlr = *(MyMenuListRec**) LMGetMenuList();
-
- mLeft = mmlr->menuInfo[0].menuLeft;
- if (mmlr->lastMenu >= OFFSET(MyMenuListRec,menuInfo[1]))
- mRight = mmlr->menuInfo[1].menuLeft;
- else
- mRight = mmlr->lastRight;
- }
-
- mainGD = GetMainDevice();
- gd = *mainGD;
-
- colorApple = false;
- if ((**(*gd).gdPMap).pixelSize > 4) // need to check for Grays
- colorApple = !!(gd->gdFlags & 0x0001);
-
- GetPort(&oldPort);
- GetWMgrPort(&wMgrPort);
- SetPort(wMgrPort);
-
- txFont = wMgrPort->txFont;
- txSize = wMgrPort->txSize;
- txMode = wMgrPort->txMode;
- txFace = wMgrPort->txFace;
-
- TextFont(geneva);
- TextSize(9);
- if (colorApple)
- {
- TextFace(italic | bold);
- TextMode(srcOr);
- }
- else
- {
- TextFace(0);
- TextMode(srcXor);
- }
-
- cWidth = CharWidth('N');
-
- if (colorApple)
- {
- // since the 'N' is italic, I want it to start 1 pixel to the left of where
- // it would normally be...
- MoveTo(mLeft + ((mRight - mLeft) >> 1) - (cWidth >> 1) - 1, 14);
- DrawChar('N');
- }
- else
- {
- Rect r = {0, 0, 1, 3};
-
- OffsetRect(&r, mLeft + ((mRight - mLeft) >> 1), 9);
- EraseRect(&r);
- --r.top;
- ++r.bottom;
- ++r.left;
- --r.right;
- EraseRect(&r);
- }
-
- TextFont(txFont);
- TextSize(txSize);
- TextFace(txFace);
- TextMode(txMode);
- }
-
- RestoreA4World(oldA4);
- }
-